<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<style>
			.mui-content{
				text-align: center;
			}
			#map{
				width:100%;height:500px;
				text-align: center;
				line-height: 500px;
				background-color: #fff;
			}
		</style>
	</head>

	<body>
		<script src="js/mui.min.js"></script>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">加速度传感器</h1>
		</header>
		<div class="mui-content">
		    <button type="button" class="mui-btn mui-btn-blue yao">摇一摇</button>
		    <button type="button" class="mui-btn mui-btn-red huo">获取设备加速度</button>
		    <button type="button" class="mui-btn mui-btn-blue jian">监听设备加速度</button>
		    <button type="button" class="mui-btn mui-btn-red ting">停止监听</button>
		    <div id="acc"></div>
		</div>
		<script src="js/mui.min.js"></script>
		<script>
			mui.plusReady(function(){
				mui(".mui-content").on("tap",".jian",function(){
			        var acc = document.getElementById("acc");
			         wac = plus.accelerometer.watchAcceleration(function(a){
			        	acc.innerHTML = "x:" + a.xAxis + "\ny:" + a.yAxis + "\nz:" + a.zAxis
			        })
					
		       });
		       mui(".mui-content").on("tap",".ting",function(){
		       	    plus.accelerometer.clearWatch(wac);
		       	    wac = null;
					
		        })
				
			})
		</script>
	</body>

</html>